package patterns.command;

import System.Task.Task;

public class PauseTaskCommand implements MachineCommand {
        private Task task;

    public PauseTaskCommand(Task task) {
            this.task = task;
        }

        @Override
        public void execute() {
            task.pause();
            task.addCommand("任务已暂停");
            System.out.println("执行: " + getDescription());
        }

        @Override
        public void undo() {
            task.resume();
            task.addCommand("任务暂停操作被撤销，任务恢复");
            System.out.println("撤销: " + getDescription());
        }

        @Override
        public String getDescription() {
            return "暂停任务 " + task.getTaskId();
        }
    }